package com.czq.spring.cloud.alibaba.consumer.controller;

import com.czq.spring.cloud.alibaba.consumer.service.EchoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RefreshScope
public class TestEchoController {

    @Autowired
    private EchoService echoService;

    @Value("${myValue}")
    private String username;

    @GetMapping(value = "/feign/echo/{str}")
    public String echo(@PathVariable("str") String string){
        return echoService.echo(string);
    }

    @GetMapping(value = "/feign/name")
    public String echo(){
        return username;
    }

    @GetMapping(value = "/lb")
    public String lb() {
        return echoService.lb();
    }
}
